# PQServer CMakeLists
# Author(s): xuming.Wong <xuming.Wong@gmail.com>

#-----------------------------------------------------------------------------
# DO NOT allow in-source builds.

if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "CMake generation for PQServer is not allowed within the source directory! 
Remove the CMakeCache.txt file and try again from another folder, e.g.: 
	rm CMakeCache.txt 
	cd ..
	mkdir PQServer_CMake_Out
	cd PQServer_CMake_Out
	cmake ../PQServer
")
endif(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

cmake_minimum_required(VERSION 2.6)
project(PQServer)

if(WIN32)
  # This seems to break Xcode projects so definitely don't enable on Apple builds
  set(CMAKE_USE_RELATIVE_PATHS true)
  set(CMAKE_SUPPRESS_REGENERATION true)
endif()
if (MSVC)
  if (CMAKE_BUILD_TOOL STREQUAL "nmake")
    # set variable to state that we are using nmake makefiles
	set(NMAKE TRUE)
  endif ()
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast")
  # Enable intrinsics on MSVC in debug mode
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Oi")
  if (CMAKE_CL_64)
    # Visual Studio bails out on debug builds in 64bit mode unless
	# this flag is set...
	set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj")
	set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /bigobj")
  endif ()
endif ()

if(WIN32)
	message(STATUS "On Windows System...")
	set(LIBDIR ${CMAKE_SOURCE_DIR}/../lib/win32)
endif(WIN32)

set(CMAKE_MODULE_PATH 
    ${CMAKE_SOURCE_DIR}/CMake
    )
	
include(PQMacros)

# dependency
#add_subdirectory(Dependency)
# Server
add_subdirectory(Server)
